<template>
	<view>
		<view class="input-wrap tp-w690" @click="handleGoSetPayPwd">
			<text>支付密码</text>
			<uni-icons type="arrowright" size="22" color="#999"></uni-icons>
		</view>
		<view class="input-wrap tp-w690" @click="handleGoBindPhone">
			<text>绑定手机号</text>
			<view class="level_align">
				<text class="tp-mr20">{{phone}}</text>
				<uni-icons type="arrowright" size="22" color="#999"></uni-icons>
			</view>
		</view>
		<view class="input-wrap tp-w690" @click="handleGolinkman">
			<text>常用联系人</text>
			<uni-icons type="arrowright" size="22" color="#999"></uni-icons>
		</view>

		<!-- #ifdef H5 -->
		<view class="input-wrap tp-w690" @click="pageJumps('/pagesUser/forgetPwd?edit=1')">
			<text>登录密码</text>
			<uni-icons type="arrowright" size="22" color="#999"></uni-icons>
		</view>
		<!-- #endif -->

		<view class="input-wrap tp-w690" @click="goToFWb(8,'用户协议')">
			<text>用户协议</text>
			<uni-icons type="arrowright" size="22" color="#999"></uni-icons>
		</view>


		<view @click="exitLogin" class="tp-btn-h88 tp-w690" style="margin-top: 200rpx;">
			退出登录
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: 0, // 0.没有设置密码 1.设置过密码
				phone: '', // 手机号
			};
		},
		onShow() {
			this.getUserIsPwd()
		},
		methods: {
			// 获取判断用户是否有设置支付密码
			getUserIsPwd() {
				this.$http.get(this.$api.publicCode).then(res => {
					if (res.code == 200) {
						if (res.data.pwdCode == 2033) {
							this.type = 0
						} else if (res.data.pwdCode == 200) {
							this.type = 1
						}
						this.phone = res.data.phone.substr(0, 3) + "****" + res.data.phone.substr(7)
					}
				})
			},
			handleGoSetPayPwd() {
				uni.navigateTo({
					url: './editPayPwd?type=' + this.type
				});
			},
			handleGoBindPhone() {
				uni.navigateTo({
					url: './bindPhone?type=0'
				});
			},
			// 常用联系人
			handleGolinkman() {
				uni.navigateTo({
					url: './linkMan'
				});
			},
			// 退出登录
			exitLogin() {
				this.$store.commit('delToken')
				uni.showToast({
					title: '退出成功',
					icon: 'none'
				})
				setTimeout(() => {
					uni.switchTab({
						url: '/pages/tabbar/home'
					});
				}, 600)


			},
			//去富文本页面
			goToFWb(type, name) {
				uni.navigateTo({
					url: '/pages/others/depositRule?type=' + type + '&name=' + name
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.input-wrap {
		padding: 0 30rpx;
		height: 88rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 30rpx;
		background-color: #fff;
		border-radius: 12rpx;
		box-sizing: border-box;
		margin-top: 20rpx;
	}
</style>
